<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/RepairRecord/repairRecord" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="repairRecord" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >发起时间：</label>
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy-MM-dd" size="12" data-toggle="datepicker" placeholder="FROM">
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy-MM-dd" size="12" data-toggle="datepicker" placeholder="TO">&nbsp;
            <label >作业员：</label>
            <input type="text" name="user" value="${user}" size="17" placeholder="作业员"/>&nbsp;
            <label >维修工单号：</label>
            <g:select name="woId" from="${repairRecordWoId}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="doc_id" optionValue="doc_id" value="${woId}" data-width="130" noSelection="['':'-- All --']" />&nbsp;
            <label >存货编码/图号：</label>
            <g:select name="part" from="${repairRecordPart}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="part" optionValue="part" value="${part}" data-width="130" noSelection="['':'-- All --']" />
            <br /><br />
            <label >状态：</label>
            <g:select name="state" from="${repairRecordState}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="state" optionValue="state" value="${state}" data-width="130" noSelection="['':'-- All --']" />&nbsp;

            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            %{--<button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/StageWip/exportExcel')" --}%
                    %{--data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;--}%
            <a type="button" class="btn btn-blue" href="${request.getContextPath()}/Base/exportExcel"
               data-toggle="doexport" data-confirm-msg="确定要导出吗？" data-icon="file-excel-o" title="导出Excel">导出</a>
        </div>
    </form>
</div>

<div class="panel-body">

    <div style="mini-width:400px;height:450px;" id="cellGlassOutputDiv"></div>
</div>

<div class="bjui-pageContent tableContent">
    <g:if test="${repairRecord.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th width="150"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${repairRecord.size()>0}">
                <g:each in="${repairRecord}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='REPAIR_HOST_TIME'&&headInstance!='RN'}">
                                <td name="tdtime${i}"><a href="${request.getContextPath()}/RepairRecord/repairRecordStep?woId1=<%=dataInstance.REPAIR_WOID%>" data-toggle="navtab"  data-id="dialog-normal" data-options="{id:'repairRecord', title:'维修记录详细'}">${dataInstance["${headInstance}"] }</a></td>
                            </g:if>
                            <g:elseif test="${headInstance!='RN'}">
                                <td name="td${i}${j}">${dataInstance["${headInstance}"] }</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
            </g:if>
            <tr>
                <td colspan="12">小计</td>
                <td name="timeSum"></td>
            </tr>
            <tr>
                <td colspan="12">合计</td>
                <td>${repairRecordSum[0].SUM_TIME}</td>
            </tr>
            </tbody>
        </table>
    </g:if>
    <g:else>
        <g:render template="../template/emptyPanel" />
    </g:else>
</div>
<g:render template="../template/51pagination" />

<script>
    $(function(){

        var timeSum=0;

        for(var i=0;i<${repairRecord.size()};i++){

            var time='tdtime'+i
            var sumTime=$("td[name='"+time+"']").text()==''?0:parseInt($("td[name='"+time+"']").text())
            timeSum+=sumTime
        }


        $("td[name='timeSum']").html(timeSum);

    })
</script>